<?php
/*
# ------------------------------------------------------------------------
# JA Teline III - Version 1.3 - Licence Owner jSharing.COM
# ------------------------------------------------------------------------
# Copyright (C) Lifetime Joomla Just for Sharing, Ltd. All Rights Reserved.
# @license - Copyrighted Commercial Software
# Author: Joomla Just for Sharing
# Websites:  http://jsharing.com -  http://jsharing.net
# This file may not be redistributed in whole or significant part.
# ------------------------------------------------------------------------
*/
	JPlugin::loadLanguage( 'mod_janews2' );
	
	require_once dirname(dirname(__FILE__)).DS.'helper.php';
	$helper = new modJaNews2Helper($module, $params);
	$sid = JRequest::getInt('group');
	$selectedCats = array();
	$cats = $helper->loadCategories($sid);
	foreach ($cats as $cat) {
		$selectedCats[] = $cat->category->id;
	}
	$categories = $helper->getAllCategoriesBySection ($sid);			
	$showimage = $helper->getUserSetting($sid, 'showimage');
	$introitems = $helper->getUserSetting($sid, 'introitems');
	$linkitems = $helper->getUserSetting($sid, 'linkitems');
	$checkall = false;
	if (count($selectedCats) == count($categories)) $checkall = true;
?>
<form class="ja-usersetting-form" method="get" action="index.php" >
	<input type="hidden" name="group" value="sid:<?php echo $sid; ?>" />

	<ul class="checkall">
		<li><input type="checkbox" id="checkall-<?php echo $module->module."-".$sid;?>" name="checkall" class="checkbox" <?php if ($checkall) echo "checked=\"checked\"";?> />
		<label for="checkall-<?php echo $module->module."-".$sid;?>"><?php echo JTEXT::_('CHECK ALL');?></label></li>
	</ul>

	<ul class="catselect">
		<?php foreach($categories as $category ): ?>
		<li>
			<input type="checkbox" <?php echo ( in_array($category->id, $selectedCats)? 'checked="checked"':'' );?> class="checkbox" value="<?php echo $category->id; ?>" id="ja-category-<?php echo $category->id; ?>" name="categories[]" />
			<label for="ja-category-<?php echo $category->id; ?>"><?php echo $category->title; ?></label>
		</li>
		<?php endforeach; ?>
	</ul>

	<ul class="options-img">
		<li>
			<label id="paramsshowimage-lbl" for="paramsshowimage" class="hasTip" title="<?php echo JTEXT::_('INTRO ITEMS NUMBER OF INTRO ITEMS.');?>"><?php echo JTEXT::_('SHOW IMAGE');?></label>
		</li>
		<li>
			<input type="radio" name="params[showimage]" id="paramsshowimage1" value="1" <?php if ($showimage) echo "checked=\"checked\"";?> class="radio" />
			<label for="paramsshowimage1"><?php echo JTEXT::_('SHOW')?></label>
		</li>
		<li>
			<input type="radio" name="params[showimage]" id="paramsshowimage0" value="0" <?php if (!$showimage) echo "checked=\"checked\"";?> class="radio" />
			<label for="paramsshowimage0"><?php echo JTEXT::_('HIDE')?></label>
		</li>
	</ul>
	
	<ul class="options-content">
		<li>
			<label id="paramsintroitems-lbl" for="paramsintroitems" class="hasTip" title="<?php echo JTEXT::_('INTRO ITEMS NUMBER OF INTRO ITEMS.');?>"><?php echo JTEXT::_('INTRO ITEMS')?></label>
			<input type="text" name="params[introitems]" id="paramsintroitems" value="<?php echo $introitems;?>" class="inputbox" />
		</li>
		<li>
			<label id="paramslinkitems-lbl" for="paramslinkitems" class="hasTip" title="<?php echo JTEXT::_('LINK ITEMS NUMBER OF LINK ITEMS.');?>">Link Items</label>
			<input type="text" name="params[linkitems]" id="paramslinkitems" value="<?php echo $linkitems;?>" class="inputbox" />
		</li>
	</ul>
	
	<p class="actions">
		<input type="button" class="button ja-submit" name="ja-submit" value="<?php echo JTEXT::_('SAVE');?>" />
		<input type="button" class="button ja-cancel" name="ja-cancel" value="<?php echo JTEXT::_('CANCEL');?>" />
	</p>
</form>